/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ejb.persistencia;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author MoisesAntonio
 */
@Entity
@Table(name = "favoritos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Favoritos.findAll", query = "SELECT f FROM Favoritos f"),
    @NamedQuery(name = "Favoritos.findByIdFav", query = "SELECT f FROM Favoritos f WHERE f.idFav = :idFav")})
public class Favoritos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdFav")
    private Integer idFav;
    @JoinColumn(name = "IdJue", referencedColumnName = "IdJuego")
    @ManyToOne(optional = false)
    private Juegos idJue;
    @JoinColumn(name = "NombreUser", referencedColumnName = "NombreUsuario")
    @ManyToOne(optional = false)
    private Usuarios nombreUser;

    public Favoritos() {
    }

    public Favoritos(Integer idFav) {
        this.idFav = idFav;
    }

    public Integer getIdFav() {
        return idFav;
    }

    public void setIdFav(Integer idFav) {
        this.idFav = idFav;
    }

    public Juegos getIdJue() {
        return idJue;
    }

    public void setIdJue(Juegos idJue) {
        this.idJue = idJue;
    }

    public Usuarios getNombreUser() {
        return nombreUser;
    }

    public void setNombreUser(Usuarios nombreUser) {
        this.nombreUser = nombreUser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFav != null ? idFav.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Favoritos)) {
            return false;
        }
        Favoritos other = (Favoritos) object;
        if ((this.idFav == null && other.idFav != null) || (this.idFav != null && !this.idFav.equals(other.idFav))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ejb.persistencia.Favoritos[ idFav=" + idFav + " ]";
    }
    
}
